package com.bwie.house.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;


import com.bwie.house.entity.AddressEntity;
import com.bwie.house.service.AddressService;
import com.bwie.house.vo.FlatsSearchVo;
import com.bwie.house.vo.ResoldSearchVo;
import com.bwie.house.vo.ResoldVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.bwie.house.entity.ResoldEntity;
import com.bwie.house.service.ResoldService;
import com.bwie.common.utils.PageUtils;
import com.bwie.common.utils.R;



/**
 * 
 *
 * @author wangguohai
 * @email 270901876@qq.com
 * @date 2022-04-21 20:35:03
 */
@RestController
@RequestMapping("house/resold")
public class ResoldController {
    @Autowired
    private ResoldService resoldService;

    @Autowired
    private AddressService addressService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = resoldService.queryPage(params);
        return R.ok().put("page", page);
    }

    @RequestMapping("/ResoldEsList")
    public R ResoldEsList(@RequestBody ResoldSearchVo resoldSearchVo){

        PageUtils page = resoldService.ResoldEsList(resoldSearchVo);

        return R.ok().put("page", page);
    }



    @RequestMapping("/xian3")
    public R xian3(){
        List<AddressEntity> list = addressService.xian31();

        return R.ok().put("data", list);
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{resoldId}")
    public R info(@PathVariable("resoldId") Integer resoldId){
		ResoldEntity resold = resoldService.getById(resoldId);

        return R.ok().put("resold", resold);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody ResoldEntity resold){
		resoldService.save(resold);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody ResoldEntity resold){
		resoldService.updateById(resold);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] resoldIds){
		resoldService.removeByIds(Arrays.asList(resoldIds));

        return R.ok();
    }

}
